home *** CD-ROM | disk | FTP | other *** search
- Path: kbad.eglin.af.mil!rpi!not-for-mail
- From: Kyle.F.Downey@williams.edu (Kyle F. Downey)
- Newsgroups: comp.lang.c++.moderated,comp.lang.c++
- Subject: redefining stdout for all C/C++ output calls
- Date: 8 Apr 1996 21:40:44 -0000
- Organization: Williams College, Williamstown MA
- Sender: cppmods@netlab.cs.rpi.edu
- Approved: vandevod@cs.rpi.edu
- Message-ID: <4kc14s$iai@netlab.cs.rpi.edu>
- NNTP-Posting-Host: netlab.cs.rpi.edu
- X-Original-Date: 8 Apr 1996 13:55:41 -0400
-
- Is there any way to redefine stdout that will work for both C-style
- (printf, etc.) and C++-style (streams) output? I would want a C++
- method that does this
-
- void f() {
- printf("Here's a C-style output line.\n");
- cout << "Here's another using streams..." << endl;
- }
-
- to send the output to a different stream. I know there's tie() for
- streams, but what about printf()? The idea here is to take a
- text-based C++ program and "capture" all screen writes to send them to
- an GUI window "stream." I want to do it so the text program need not be
- rewritten. So you would take the main() function of the program and
- call it, say, tmain() and pass it as a function pointer to a program
- that would run it after redefining stdout.
-
- Any ideas?
-
- (If you've seen the SIOUX library under the Metrowerks C/C++ compiler,
- you'll know what I am thinking about.)
-
- --kd
-
- [ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
- [ Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm ]
- [ Moderation policy: http://www.connobj.com/cpp/guide.htm ]
- [ Comments? mailto:c++-request@netlab.cs.rpi.edu ]
-